From 3122210cbe3ccd5e83d1a2d1415d370d46834052 Mon Sep 17 00:00:00 2001
From: Chris Taylor <chris@code-monkeys.org>
Date: Fri, 05 Mar 2010 06:09:20 +0000
Subject: Fix segfault in playlist creation.

Audtty would segfault if buffer length was 0 and ENTER was pressed.


Signed-off-by: Chris Taylor <chris@code-monkeys.org>
---
diff --git a/playlist_create.c b/playlist_create.c
index 0cd0088..475a494 100644
--- a/playlist_create.c
+++ b/playlist_create.c
@@ -48,6 +48,11 @@ void playlist_create( void )
 				case ESCAPE:
                                         return;
 				case ENTER:
+
+                                    if(strlen(buffer)==0) {
+                                        return;
+                                    }
+                                    else {
                                         file=fopen(buffer,"w");
                                         for(i=0;i<list.length;i++)
                                         {
@@ -55,6 +60,7 @@ void playlist_create( void )
                                             fputs("\n",file);
                                         }
                                         fclose(file);
+                                    }
                                         return;
 				case KEY_BACKSPACE:
 					if (len == 0) break;
--
cgit v0.8.3.4-115-g1759
